<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ page trimDirectiveWhitespaces="true" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>动物详情</title>
<link rel="stylesheet" href="../css/reset1.css">
<link rel="stylesheet" href="../css/index.css">

<link rel="stylesheet" href="../css/bootstrap.min.css" />
<link rel="stylesheet" href="../css/style3.css" />
<script src="../js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
<script type="text/javascript" src="../js/indexseo.js" ></script>
<script src="../js/slider.js"></script>
<script src="../js/navChange.js"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="../js/messages_zh.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.cookie.js"></script>
<script type="text/javascript">
var E3MALL = {
		checkLogin : function(){
			var _ticket = $.cookie("token");
			if(!_ticket){
				return ;
			}
			$.ajax({
				url : "${pageContext.request.contextPath }/user/token/" + _ticket,
				dataType : "jsonp",
				type : "GET",
				success : function(data){
					if(data.status == 200){
						var username = data.data.username;
						/* alert("hello"+username); */
						/* var html = username + "，欢迎您！<a href=\"http://www.e3mall.cn/user/logout.html\" class=\"link-logout\">[退出]</a>"; */
						var html = "<div class='navbar-right' style='display: inline-block;padding-top: 10px;'>"+
				          "<div class=''>"+
				          	"<ol class='list-inline'>"+
				          		"<li>欢迎您,<font style='color: red;'>"+username+"</font></li>|"+
				          		"<li><a href='${pageContext.request.contextPath}/user/logout/"+_ticket+"' class='link-logout'>[退出]</a></li>"+
				          	"</ol>"+
				          "</div>"+
				          "</div>";
						$("#loginbar").html(html);
					}
				}
			});
		}
	}
<%-- 	
var E3MALL1 = {
		saveAdopt : function(){
			var y = confirm("确定收养？");
			if(!y){
				return ;
			}
			$.post(
					"<%=basePath%>adopt/saveAdopt",
					$("#adoptForm").serialize(),
					function (data) {
						alert("收养成功!请留意邮件通知!");
						location.href="<%=basePath%>adopt/adoptList";
					}
			);
			
			$.ajax({
				url : "<%=basePath%>adopt/saveAdopt",
				data:$("#adoptForm").serialize(),
				dataType : "json",
				type : "POST",
				success : function(data){
					alert("收养成功!请留意邮件通知!");
					location.href="<%=basePath%>adopt/adoptList";
				}
			});
		}
	} --%>

	$(function(){
	// 查看是否已经登录，如果已经登录查询登录信息
	E3MALL.checkLogin();
	

});
</script>

<script>
		function saveAdopt() {
			var y = confirm("确定收养？");
			if(y){
				$.post(
						"<%=basePath%>adopt/saveAdopt",
						$("#adoptForm").serialize(),
						function (data) {
							
							alert("收养成功!请留意邮件通知!");
							location.href="<%=basePath%>adopt/adoptList";
						}
				);
			}	
		}
</script>
<style>	
  /* Make the image fully responsive */
.carousel-inner img {
     width: 100%;
     height: 100%;
}
</style>
</head>
<body style="overflow-x:hidden;padding-bottom: 50px;">

	<jsp:include page="/WEB-INF/jsp/head.jsp"></jsp:include>
		
		<!--新闻标题列表-->
		<div class="container">
			<div class="col-lg-2">
				
			</div>
			
			<div class="col-lg-8 col-lg-offset-2" style="border: 1px solid #E7E7E7;background-color: antiquewhite;padding-top: 5px;">
				<div class="row">
					<!--标题-->
					<h4>详情:</h4>
					<div class="col-lg-8" style="background-color: antiquewhite; padding-top: 5px;padding-bottom: 20px;">
						<form class="form-horizontal" role="form">
							
							<div class="form-group" style="padding-bottom: 1px;">
								<label class="col-sm-2 control-label">品种:</label>
								<div class="col-sm-10">
									<c:if test="${petInfo.pkind==1 }">
									<p class="form-control-static">狗狗</p>
									</c:if>
									
									<c:if test="${petInfo.pkind==2 }">
									<p class="form-control-static">猫猫</p>
									</c:if>
									
									<c:if test="${petInfo.pkind==3 }">
									<p class="form-control-static">其他</p>
									</c:if>
								</div>
								<div style="clear:both;"><hr style="background-color: #111111;height: 1px;"/></div>
							</div>
							
							<div class="form-group" style="padding-top: 0px;">
								<label class="col-sm-2 control-label">性别:</label>
								<div class="col-sm-10">
										<p class="form-control-static">${petInfo.psex==1?"男":"女" }</p>
									
								</div>
								<div style="clear:both;"><hr style="background-color: #111111;height: 1px;"/></div>
							</div>
							
							<div class="form-group" style="padding-bottom: 1px;">
								<label class="col-sm-2 control-label">年龄:</label>
								<div class="col-sm-10">
									<p class="form-control-static">${petInfo.page }</p>
								</div>
								<div style="clear:both;"><hr style="background-color: #111111;height: 1px;"/></div>
							</div>
							
							<div class="form-group" style="padding-bottom: 1px;">
								<label class="col-sm-2 control-label">体重:</label>
								<div class="col-sm-10">
									<p class="form-control-static">${petInfo.pweight }</p>
								</div>
								<div style="clear:both;"><hr style="background-color: #111111;height: 1px;"/></div>
							</div>
							
							<div class="form-group" style="padding-bottom: 1px;">
								<label class="col-sm-2 control-label">动物编号:</label>
								<div class="col-sm-10">
									<p class="form-control-static">${petInfo.id }</p>
								</div>
								<div style="clear:both;"><hr style="background-color: #111111;height: 1px;"/></div>
							</div>

							<!--<span><hr style="background-color: #111111;height: 1px;"/></span>-->
							
						</form>
					</div>
					<!--图片,名字-->
					<div class="col-lg-4" style="background-color: antiquewhite;text-align:center; padding-top: 5px;padding-bottom: 20px;">
						<span>
							<div style="background: black; padding: 0px;" class="img-thumbnail">
								<img class="img-responsive img-rounded" style="height: 200px;width: 200px;" src="${petInfo.pimage }">
								<font style="color: #21A9E7;font-size: xx-large;">${petInfo.pname }</font>
						</div>
						</span>
					</div>
					
				</div>
				
				<!--描述-->
				<div class="row">
					<h4>关于我:</h4>
					<!--<hr style="background-color: #111111;height: 1px;"/>-->
					
					<div class="col-lg-12" style="margin: auto;">
						<p>${petInfo.pdesc }</p>
					</div>
				</div>
				
				<!--收养按钮-->
				<div class="row" style="padding-top: 10px;">
					<div class="col-lg-12" style="margin: auto;">
					<form action="" id="adoptForm" method="post">
							<input type="hidden" id="adoptname" name="adoptname" value="${petInfo.pname }">
							<input type="hidden" id="adpotimage" name="adpotimage" value="${petInfo.pimage }">
							<input type="hidden" id="adoptkind" name="adoptkind" value="${petInfo.pkind }">
							<input type="hidden" id="adoptnum" name="adoptnum" value="${petInfo.id }">
							<input type="hidden" id="adoptman" name="adoptman" value="${user.username }">
							<input type="hidden" id="adopttel" name="adopttel" value="${user.tel }">
							<input type="hidden" id="adoptemail" name="adoptemail" value="${user.email }">
						<button type="button" class="btn btn-primary" onclick="saveAdopt()">收养它</button>
					</form>
					
					</div>
				</div>
			</div>
			
		</div>

  

   
		
		
		<!--底层-->
		<nav class="navbar-fixed-bottom">
			<header class="header" style="background-color: gainsboro;">
		      <div class="container1">
		      	
		        <ul class="nav" style="padding-top: 5px;">
		          <li class="nav" style="display: inline;">
		            <p>CopyRight@201624131105</p>
		          </li>
		        </ul>
		        
		      </div>
		    </header>
		    </nav>
</body>
</html>
